{template header}
{template nav}
<div class="sidnav">您的位置：&nbsp;
    <a href="{url index.php?m=car}" target="_blank" >首页</a>&nbsp;&gt;&nbsp;
  <a href="{url index.php?m=car&f=sell}" target="_blank" >我要卖车</a>&nbsp;&gt;&nbsp;发布车源
</div>


<script language="JavaScript">
<!--
function checkdata() {
if( $('#title').val() =="" || $('#title').val().length<1) {
alert("\n·请输入标题");
$('#title').focus(); 
return false;
}
if( $('#brand2').val() ==0 ) {
alert("\n·请选择车型");
return false;
}
if( $('#cid').val() ==0 ) {
	alert("\n·请选择车辆类别");
	return false;
	}
if( $('#color').val() =="" ) {
alert("\n·请选择车身颜色");
return false;
}
if( $('#shangpaiy').val() =="" || $('#shangpaim').val()=="") {
alert("\n·请选择上牌日期");
return false;
}
if( $('#pailiang').val() =="") {
	alert("\n·请输入排气量");
	$('#pailiang').focus(); 
	return false;
	}
if( $('#licheng').val() =="" || $('#licheng').val()<0.01) {
	alert("\n·请输入正确的行驶里程");
	$('#licheng').focus(); 
	return false;
	}
if( $('#price').val()=="") {
	alert("\n·请输入正确的车辆价格\n\n·面议请填0");
	$('#price').focus(); 
	return false;
	}
if( $('#contact').val() =="" || $('#contact').val().length<2) {
	alert("\n·请输入车主姓名");
	$('#contact').focus(); 
	return false;
	}
if( $('#phone').val() =="" || $('#phone').val().length<11) {
	alert("\n·请输入联系电话");
	$('#phone').focus(); 
	return false;
	}
if( $('#jianjie').val() =="") {
	alert("\n·为了便于用户了解你的车信息，请输入简要的文字介绍车辆情况");
	$('#phone').focus(); 
	return false;
	}		
if( $('#description').val().length>250) {
alert("\n·请输入不多于250字符的车辆详细配置");
return false;
}
return true;
}
function isNumberString (InString,RefString)
{
if(InString.length==0) return (false);
for (Count=0; Count < InString.length; Count++)  {
	TempChar= InString.substring (Count, Count+1);
	if (RefString.indexOf (TempChar, 0)==-1)  
	return (false);
}
return (true);
}

function showHide (id) 
{ 
var style = document.getElementById(id).style 
if (style.display == "none") 
style.display = "inline"; 
else 
style.display = "none"; 
} 
function showxt (id) 
{ 
var style = document.getElementById(id).style 
if (style.display == "none") 
style.display = "block"; 
else 
style.display = "none"; 
} 


function change_worker()
{
var ddlcolor=$("#ddlcolor").val();
 $("#color").val(ddlcolor);
}
// -->
</script>
<script language="javascript">
<!--
	function selectl(obj,data){
		if($(obj).attr("checked")=="checked"){
			$('#description').append(data+', ');
		}else{
			var a=$('#description').html();
			$('#description').html(a.replace(data+', ',''));
		}
	}
//-->
</script>

<table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="620" height="400" valign="top" class="fbbg1"><table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="501" height="35">&nbsp;<span class="f14bs">发布车源信息</span></td>
        <td width="99"><span class="f12cright">注*为必填</span></td>
      </tr>
      <tr>
        <td height="2" colspan="2" bgcolor="#E1E1E1"></td>
      </tr>
    </table>
    <table width="600" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table><form name="addform" method="post" action="{url index.php?m=car&f=addcar}" onSubmit="return checkdata()"  autocomplete="off">
<table width="100%" border="0" align=center cellpadding="5" cellspacing="1">
<tr>
    <td width="19%" height=30 align=right><font color=red>*</font>标题：</td>
	<td width="81%" bgcolor="#FFFFFF">
	<input type="hidden" name="fabu" id="fabu" value=1>
	<input type="hidden" name="id" id="id" value={$id}>
	<input name="title" type="text" size="60" value="{$data['title']}" class="inputm" maxlength="60" id="title"/>
    
    </td>
  </tr>

 
  <tr>
    <td width="19%" height=30 align=right><font color=red>*</font>车    型：</td>
	<td width="81%" bgcolor="#FFFFFF">
	<select name="brand1" id="brand1" onchange="get_brand(this)" class="select_box1"><option value="0">请选择品牌...</option>
	 	{if $data['bid']}
       {get_brands_parent_options_bychild($data['bid'])}
       {else}
       {get_brands_parent(2,0)}
       {/if} </select>
<select name="brand2" id="brand2" class="select_box1"><option value="0">请选择车系...</option>
{if $data['bid']}
{get_brands_brother_options($data['bid'])}
{/if}
</select>
    </td>
  </tr>
  <tr>
    <td height=30 align=right><font color=red>*</font>车辆类别：</td>
<td bgcolor="#FFFFFF"><SELECT id="cid" name="cid" class="select_box1">
                        <OPTION value="0" selected>请选择</OPTION>
                        {get_brands_parent(1,$data['cid'])} </SELECT></td>
  </tr>
  
  
  <tr>
    <td height=30 align=right><font color=red>*</font>变速箱类型：</td>
	<td bgcolor="#FFFFFF">
	  <input name="biansu" type="radio" id="biansu" value="1" {if $data['biansu']==1}checked{/if} >
	  手动&nbsp;
       <input type="radio" name="biansu" id="biansu" value="2" {if $data['biansu']==2}checked{/if} >
      自动&nbsp;
      <input type="radio" name="biansu" id="biansu" value="3" {if $data['biansu']==3}checked{/if} >
      手自一体&nbsp;
      <input type="radio" name="biansu" id="biansu" value="4" {if $data['biansu']==4}checked{/if} >
      无级变速</td>
  </tr>
  
 <tr><td height=33 align=right><font color=red>*</font>车身颜色：</td>
 <td><select name="ddlcolor" id="ddlcolor"  class="select_box1" onChange="change_worker();">
	<option value="">请选择</option>
	<option value="黑色" {if $data['color']=='黑色'}selected="selected"{/if}>黑色</option>
	<option value="白色" {if $data['color']=='白色'}selected="selected"{/if}>白色</option>
	<option value="银灰色" {if $data['color']=='银灰色'}selected="selected"{/if}>银灰色</option>
	<option value="深灰色" {if $data['color']=='深灰色'}selected="selected"{/if}>深灰色</option>
	<option value="咖啡色" {if $data['color']=='咖啡色'}selected="selected"{/if}>咖啡色</option>
	<option value="红色" {if $data['color']=='红色'}selected="selected"{/if}>红色</option>
	<option value="蓝色" {if $data['color']=='蓝色'}selected="selected"{/if}>蓝色</option>
	<option value="绿色" {if $data['color']=='绿色'}selected="selected"{/if}>绿色</option>
	<option value="黄色" {if $data['color']=='黄色'}selected="selected"{/if}>黄色</option>
	<option value="橙色" {if $data['color']=='橙色'}selected="selected"{/if}>橙色</option>
	<option value="香槟色" {if $data['color']=='香槟色'}selected="selected"{/if}>香槟色</option>
	<option value="紫色" {if $data['color']=='紫色'}selected="selected"{/if}>紫色</option>
	<option value="多彩色" {if $data['color']=='多彩色'}selected="selected"{/if}>多彩色</option>

</select>


&nbsp;
              <input name="cbxOtherColor" type="checkbox" id="cbxOtherColor"  onClick="$('#color').toggle();" />
其他颜色
              <input name="color" type="text" maxlength="10" id="color" value="{$data['color']}"  class="inputm" style="display: none" />
 
 
 </td>
 </tr>
  
  <tr>
    <td height=30 align=right><font color=red>*</font>上牌日期：</td>
<td bgcolor="#FFFFFF">
<select name="shangpaiy" id="shangpaiy"  class="select_box1">
	<option value="">选择年份</option>
	{php $shangpai=gdate('Y',$data['shangpai']);}
	{php $year=range(intval(gdate('Y')),gdate('Y')-15)}
	{loop $year $v}
    <option value="{$v}" {if $shangpai==$v}selected="selected" {/if}>{$v}</option>
    {/loop}


</select>&nbsp;<select name="shangpaim" id="shangpaim"  class="select_box1">
	<option {if !$data['shangpaim']}selected="selected"{/if} value="">月份</option>
	<option {if gdate('m',$data['shangpai'])==1}selected="selected" {/if}value="1">1</option>
	<option {if gdate('m',$data['shangpai'])==2}selected="selected" {/if}value="2">2</option>
	<option {if gdate('m',$data['shangpai'])==3}selected="selected" {/if}value="3">3</option>
	<option {if gdate('m',$data['shangpai'])==4}selected="selected" {/if}value="4">4</option>
	<option {if gdate('m',$data['shangpai'])==5}selected="selected" {/if}value="5">5</option>
	<option {if gdate('m',$data['shangpai'])==6}selected="selected" {/if}value="6">6</option>
	<option {if gdate('m',$data['shangpai'])==7}selected="selected" {/if}value="7">7</option>
	<option {if gdate('m',$data['shangpai'])==8}selected="selected" {/if}value="8">8</option>
	<option {if gdate('m',$data['shangpai'])==9}selected="selected" {/if}value="9">9</option>
	<option {if gdate('m',$data['shangpai'])==10}selected="selected" {/if}value="10">10</option>
	<option {if gdate('m',$data['shangpai'])==11}selected="selected" {/if}value="11">11</option>
	<option {if gdate('m',$data['shangpai'])==12}selected="selected" {/if}value="12">12</option>

</select></td>
  </tr>
  
  <tr>
    <td height=30 align=right><font color=red>*</font>排气量：</td>
	<td bgcolor="#FFFFFF"><input name="pailiang" type="text" class="inputm" id="pailiang" value="{$data['pailiang']}" size="10" maxlength="5"  onblur="this.value=money(this.value,1)">
	  升 </td>
  </tr>
<tr>
    <td height=30 align=right><font color=red>*</font>行驶里程：</td>
	<td bgcolor="#FFFFFF"><input name="licheng" type="text" class="inputm" id="licheng" value="{$data['licheng']}"  size="10" maxlength="8"  onblur="this.value=money(this.value)">
	<font color="#FF0000">万</font>公里 </td>
  </tr>
  <tr>
    <td height=30 align=right><font color=red>*</font>出售价格：</td>
	<td bgcolor="#FFFFFF"><input name="price" type="text" class="inputm" id="price" value="{$data['price']}" size="10" maxlength="8"  onblur="this.value=money(this.value)" >
	<font color="#FF0000">万</font>元 </td>
  </tr>

<tr>
    <td height=30 align=right><font color=red>*</font>车主姓名：</td>
	<td bgcolor="#FFFFFF"><input name="contact" type="text" class="inputm" id="contact" value="{$data['contact']}" size="40" maxlength="40"  >
	 </td>
  </tr>
  <tr>
    <td height=30 align=right><font color=red>*</font>联系电话：</td>
	<td bgcolor="#FFFFFF"><input name="phone" type="text" class="inputm" id="phone" value="{$data['phone']}" size="40" maxlength="40"  >
	 </td>
  </tr>
  <tr>
    <td height=30 align=right><font color=red>*</font>车辆介绍：</td>
	<td bgcolor="#FFFFFF"><input name="jianjie" type="text" class="inputm" value="{$data['jianjie']}" id="jianjie" size="60">
	 </td>
  </tr>
</table>

<table width="100%">
    
    <tbody><tr>
    <td width="19%" height="65" align="right" class="XXX">功能性配置：&nbsp;</td>
	<td bgcolor="#FFFFFF" class="XXX">
    <table width="100%" cellspacing="0" cellpadding="0" border="0">
  <tbody><tr>
    <td width="25%"><input type="checkbox" {if in_array('GPS导航',$data['descriptions'])}checked{/if} value="1" onclick="selectl(this,'GPS导航')" id="checkbox2" name="checkbox2">
GPS导航</td>
    <td width="25%"><input type="checkbox" {if in_array('倒车雷达',$data['descriptions'])}checked{/if} value="1" onclick="selectl(this,'倒车雷达')" name="checkbox3">
倒车雷达</td>
    <td width="25%"><input type="checkbox" {if in_array('倒车影像系统',$data['descriptions'])}checked{/if} value="1" onclick="selectl(this,'倒车影像系统')" name="checkbox4">
倒车影像系统</td>
    <td><input type="checkbox" value="1" {if in_array('助力转向',$data['descriptions'])}checked{/if} onclick="selectl(this,'助力转向')" name="checkbox5">
助力转向</td>
  </tr>
  <tr>
    <td><input type="checkbox" value="1" {if in_array('定速巡航',$data['descriptions'])}checked{/if} onclick="selectl(this,'定速巡航')" name="checkbox6">
定速巡航 </td>
    <td><input type="checkbox" value="1" {if in_array('中控锁',$data['descriptions'])}checked{/if} onclick="selectl(this,'中控锁')" name="checkbox7">
中控锁 </td>
    <td><input type="checkbox" value="1" {if in_array('钥匙遥控',$data['descriptions'])}checked{/if} onclick="selectl(this,'钥匙遥控')" name="checkbox8">
钥匙遥控 </td>
    <td><input type="checkbox" value="1" {if in_array('CD/VCD',$data['descriptions'])}checked{/if} onclick="selectl(this,'CD/VCD')" name="checkbox9">
CD/VCD</td>
  </tr>
</tbody></table>
    
    </td>
  </tr>
    <tr>
    <td height="65" align="right" class="XXX">其他配置：&nbsp; </td>
	<td bgcolor="#FFFFFF" class="XXX">
    <table width="100%" cellspacing="0" cellpadding="0" border="0">
  <tbody><tr>
    <td width="25%"><input type="checkbox" {if in_array('天窗',$data['descriptions'])}checked{/if} value="1" onclick="selectl(this,'天窗')" name="checkbox10">
天窗 </td>
    <td width="25%"><input type="checkbox" {if in_array('电动车窗',$data['descriptions'])}checked{/if} value="1" onclick="selectl(this,'电动车窗')" name="checkbox11">
电动车窗 </td>
    <td width="25%"><input type="checkbox" {if in_array('多功能方向盘',$data['descriptions'])}checked{/if} value="1" onclick="selectl(this,'多功能方向盘')" name="checkbox12">
多功能方向盘</td>
    <td><input type="checkbox" value="1" {if in_array('座椅加热',$data['descriptions'])}checked{/if} onclick="selectl(this,'座椅加热')" name="checkbox13">
座椅加热</td>
  </tr>
  <tr>
    <td><input type="checkbox" value="1" {if in_array('空调',$data['descriptions'])}checked{/if} onclick="selectl(this,'空调')" name="checkbox14">
空调</td>
    <td><input type="checkbox" value="1" {if in_array('真皮座椅',$data['descriptions'])}checked{/if} onclick="selectl(this,'真皮座椅')" name="checkbox15">
真皮座椅 </td>
    <td><input type="checkbox" value="1" {if in_array('安全气囊',$data['descriptions'])}checked{/if} onclick="selectl(this,'安全气囊')" name="checkbox16">
安全气囊 </td>
    <td><input type="checkbox" value="1" {if in_array('ABS',$data['descriptions'])}checked{/if} onclick="selectl(this,'ABS')" name="checkbox17">
ABS</td>
  </tr>
</tbody></table>
    
    </td>
  </tr>
  <tr>
    <td height="30" align="right" class="XXX">详细配置：&nbsp;</td>
	<td bgcolor="#FFFFFF" class="XXX"><label>
	  <textarea rows="5" cols="55" class="borderm" id="description" style="font-size:13px;padding:3px;" name="description"> {$data['description']} </textarea>
	</label></td>
  </tr>
  			{if !empty($attachments)}
			<tr>
				<td></td>
				<td>
				<table width="98%" cellspacing="1">
					<tr>
						<th>文件名</th>
						<th width="80">文件大小</th>
						<th width="120">上传时间</th>
						<th width="100">操作</th>
					</tr>
					{loop $attachments $attach}
					<tr id="tr_{$attach['fid']}" onmouseover="this.className='bg2'" onmouseout="this.className=''">
						<td>
						<?php
						if ( stristr($attach['filetype'], 'image') ) {
							$src = $attach['filepath'];
							//$preview ='<div class="preview" id="attach_'.$attach['fid'].'"><img src="'.DATA_DIR.'files/'.$src.'" class="thumb" /></div>';
							$insert = '[img]'.$src.'[/img]';
							if(!empty($attach['thumb']))$insert_thumb = '[img]'.$attach['thumb'].'[/img]';
						} else {
							$preview = '';
							$insert = '[file]'.$src.'[/file]';
						}
						$s='<img src='.DATA_DIR.'files/'.$src.'>';
						echo ' <a href="'.DATA_DIR.'files/'.$src.'" target="_blank" class="attach">'.$attach['originalname'].$preview.'</a>';
						?>
						</td>
						<td width="80">{sizecount($attach['filesize'])}</td>
						<td width="120">{gdate('Y-m-d H:i',$attach['dateline'])}</td>
						<td width="50"><a href="javascript:;" onclick="del_attach({$attach['fid']})">删除</a> &nbsp;&nbsp; 
						{if $data['picture'] && ($attach['filepath'] == $data['picture'] || $attach['thumb'] == $data['picture'])}<a href="javascript:;" onclick="del_front({$data['id']})">取消封面</a>
						{else}
						<a href="javascript:;" onclick="to_front({$attach['fid']},{$data['id']})">设为封面</a>
						{/if} </td>
					</tr>
					{/loop}
				</table>
				</td>
			</tr>
			<script type="text/javascript">
			function del_attach(id) {
				if(!confirm('确定删除？')) return false;
				if(id){
					$.getJSON('index.php?m=upload&f=delete&id='+id+'&tm='+Math.random(),'',function(data){
						if(data.s==true){
							$('#tr_'+id).remove();
						}else{
						}
					});
				}
			}
			function to_front(id,aid) {
				$.ajax({
					type:'POST',
					url:'index.php?m=car&f=to_front&id='+id+'&aid='+aid,
					cache:false,
					success:function(msg) {
						if (msg == 'success') {
							$("#tr_"+id).addClass('highlight');
							//$("#tr_"+id).fadeOut('slow');
							alert('成功设为封面,如果此图片你还没有使用，你需要保存一下内容。')
						}
					}
				});
			}
			function del_front(id) {
				if(!confirm('确定取消封面？')) return false;
				$.ajax({
					type:'POST',
					url:'index.php?m=car&f=del_front&aid='+id,
					cache:false,
					success:function(msg) {
						if (msg == 'success') {
							$("#tr_"+id).addClass('highlight');
							alert('成功取消封面,需要刷新下才能看到结果。')
						}
					}
				});
			}
			
			
			</script>
			{/if}
  <tr>
    <td height="30" align="right" class="XXX">车辆图片：&nbsp;</td>
	<td bgcolor="#FFFFFF" class="XXX"><input type="hidden" id="default_image" name="default_image" value="0">
	
  <iframe src="{url index.php?m=upload&t=1}" width="100%" style="height:30px;" id="uploadframe"  frameborder="0" scrolling="auto" ></iframe>
  </td>
  </tr>
  
    </tbody></table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="70" align="center"><label>
      <input type="submit" value="发布" class="button" style="border:0">
    </label></td>
  </tr>
</table>

</form>
    </td>
    <td width="10"></td>
    <td width="320" valign="top" class="fbbg_2">
    <table width="310" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="501" height="35">&nbsp;<span class="f14bs">发布车源说明</span></td>
        
      </tr>
      <tr>
        <td height="2" colspan="2" bgcolor="#E1E1E1"></td>
      </tr>
    </table>
    <table width="80%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
    <table width="310" border="0" align="center" cellpadding="5" cellspacing="1">
      <tr>
        <td width="13" height="33">·</td>
        <td width="254">填写品牌型号，常见车型可点击右侧快捷按钮</td>
      </tr>
      <tr>
        <td height="33">·</td>
        <td>选择车辆类别，以便于车辆分类</td>
      </tr>
      <tr>
        <td height="33">·</td>
        <td>变速箱类型对车辆价格有一定影响，请选择</td>
      </tr>
      <tr>
        <td height="33">·</td>
        <td>排量请填写数字，小数点用半角英文&quot;.&quot;非&quot;。&quot;</td>
      </tr>
      <tr>
        <td height="33">·</td>
        <td>常见颜色请直接选择，也可点击“其他”自己填写</td>
      </tr>
      <tr>
        <td height="33">·</td>
        <td>请选择上牌年份及月份</td>
      </tr>
      <tr>
        <td height="33">·</td>
        <td>里程单位“万公里”</td>
      </tr>
      <tr>
        <td height="33">·</td>
        <td>价格单位“万元”</td>
      </tr>
      <tr>
        <td height="33">·</td>
        <td>详细配置可选择或自己填写，有助于快速出售</td>
      </tr>
    </table></td>
  </tr>
</table>



{template footer}